<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="icon" href="{{asset('home_new/favicon.ico')}}" />
        @section('title')

        @show
        <link href="{{asset('home/js/skin/layer.css')}}" type="text/css" rel="stylesheet" />
        <link href="{{asset('home_new/css/loginPop.css')}}" type="text/css" rel="stylesheet" />
        <script type="text/javascript" src="{{asset('pulgin/layer/layer.js')}}"></script>
        <script src="http://static.geetest.com/static/tools/gt.js"></script>
    </head>
    <style>.index_title .index_titleMain a.plusRecom_title, .index_title .index_titleMain a.plusArt_title {color:#333;}</style>
    <body>
    <div class="global_header smallHead">
        <div class="header_inner clear">
            <a class="inner_logo index_icons global_gaNode" href="/" data-galabel="home_header_logo">
            </a>
            <div class="account_wrap">
                <div class="header_account clear">
                    <ul class="account_nav clear">
                        <li>
                            <a class="" href="{{ url('/') }}">
                                首页
                            </a>
                        </li>
                        @foreach($top_cate as $v)
                            <li>
                                <a class="global_gaNode" href="{{url(''.$v->cate_url.'')}}">
                                    {{$v->cate_name}}
                                </a>
                            </li>
                        @endforeach
                        <li>
                            <a class="" href="#" target="_blank">
                                奇艺秀
                            </a>
                        </li>
                    </ul>
                    <div class="account_right clear">
                        <div class="header_search clear">
                            <input class="head_searchInput" placeholder="搜点什么..." />
                            <div class="index_icons head_searchIcon global_gaNode" data-type="video"
                                 data-galabel="home_header_search">
                            </div>
                        </div>
                        <div class="account_seperate">
                        </div>
                        @if(!empty(session('user')))
                        <div class="inner_account">
                            <a href="{{route('search')}}" target="_blank" class="account_search index_icons">
                            </a>
                            <a href="{{url('member/userCollect')}}" target="_blank" class="account_message global_gaNode">
                                收藏 <span class="message_num"></span>
                            </a>
                            <a href="{{url('member/userFollow')}}" target="_blank" class="account_letter global_gaNode">
                                关注 <span class="letter_num"></span>
                            </a>
                                <span class="account_user clear">
                                    <a class="img_link global_gaNode clear" data-galabel="home_header_user_img"
                                       href="{{url('member/index')}}">
                                        <img class="user_img" src="{{session('user')->head_img}}" onerror="this.src='{{asset('img/100100.png')}}'"
                                             alt="会员头像" />
                                    </a>
                                    <span class="user_active smallHead">
                                        <a href="{{url('member/index')}}" class="active_name" rel="nofollow">
                                            {{session('user')->nickname}}
                                        </a>
                                        <a href="{{url('auth/logout')}}" rel="nofollow">
                                            退出
                                        </a>
                                    </span>
                                </span>
                            <div class="account_list message_list clear">
                            </div>
                            <div class="account_list sms_list clear">
                            </div>
                            <div class="sms_inform">
                                <div class="account_list  clear">
                                    <div class="sms_arrow account_list_arrow" totalnum="3">
                                    </div>
                                    <div class="sms_inform_list">
                                        <ul>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        @else
                            <a href="{{route('search')}}" target="_blank" class="account_search index_icons search_icon">
                            </a>
                        <div class="inner_login">

                            <a class="login_in global_gaNode" href="#"
                               data-galabel="home_header_login">
                                登录&nbsp;&nbsp;|&nbsp;
                            </a>
                            <a class="logoutCss global_gaNode reg" href="#"
                               data-galabel="home_header_reg">
                                注册
                            </a>
                        </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>

    @section('content')
        @show
    <div class="global_footer">
        <div class="foot-line"></div>
        <div class="footer_inner">
            <div class="inner_link clear">
                <dl>
                    <p class="logo_footer index_icons"></p>
                </dl>
                <dl>
                    <dt>奇异果资讯</dt>
                    <dd>
                        @foreach($qyg as $v)
                            <a href="{{url('/qyg').'/'.$v->cate_url}}">{{$v->cate_name}}</a>
                        @endforeach
                    </dd>
                </dl>
                <dl>
                    <dt>关于我们</dt>
                    <dd>
                        @foreach($about as $v)
                            <a href="{{url('/about').'/'.$v->cate_url}}">{{$v->cate_name}}</a>
                        @endforeach
                    </dd>
                </dl>
                <dl class="footer_follow">
                    <dt>关注我们</dt>
                    <dd>
                        <a class="global_gaNode"
                           target="_blank" rel="nofollow" href="http://weibo.com/u/5897732591">
                            新浪微博
                        </a>
                        <a class="global_gaNode"
                           target="_blank" href="{{url('/about').'/joinus'}}">
                            联系我们
                        </a>
                    </dd>
                </dl>
                <dl class="footer_wechat">
                    <dt> 官方微信 </dt>
                    <dd class="wechat_img"> </dd>
                </dl>
                <dl class="footer_appDownload">
                    <dt> Q群196241900 </dt>
                    <dd class="app_img"> </dd>
                </dl>
            </div>
            <div class="footer_message">
                <div class="footer_pcMsg clear">
                    <div class="inner_copyr">
                            <span class="inner_no">
                                <a class="global_gaNode"
                                   target="_blank" rel="nofollow">
                                    © 2016 QIYIGUO | 奇异果聚合 | 昆明尚合科技有限公司 | 滇ICP备12006567号-20
                                </a>
                            </span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="{{asset('home_new/js/libs.js')}}"></script>
    <script src="{{asset('home_new/js/global.js')}}"></script>
    <script>
        $(function() {
            Z.use('global/mediaHeader');
            Z.use('mediaIndex/mediaIndex');
            Z.use('media/page');
//            Z.use('global/header');
            Z.use('footer/footer');
        });
    </script>

        <span style="display:none;">
    <!--统计代码-->
            {!! $global->count_code !!}
        <!--推送代码-->
           {!! $global->push_code !!}
        </span>
    </body>
</html>

<script>

    $(function() {

        //注册
        $('.reg').click(function(){
           location.href = "{{url('register')}}";
        });
        var url = "{{url('auth/startCaptcha')}}";
        var reg_url = "{{url('register')}}";
        var forget_url = "{{url('forget')}}";
        var qq_login = "{{url('auth/qq')}}";
        var wx_login = "{{url('auth/weixinWeb')}}";
        var wb_login = "{{url('auth/weibo')}}";
        var login = {
            init: function () {

                $('.login_in').click(function () {

                    layer.open({
                        type: 1,
                        title: false,
                        area: ['auto', 'auto'],
                        shift: 'left', //从左动画弹出
                        closeBtn: 0,
                        shadeClose: true,
                        zIndex: 899990,
                        content: '<div class="login-pop"data-point="dlk"><div class="login-pop-close"></div><div class="login-pop-tab"><ul><li><a href="#" class="t-login current">登录</a></li><li><a href="' + reg_url + '" target="_blank">注册</a></li></ul></div><div class="login-pop-cont clearfix"><div class="c-item clearfix popLogin"><form method="post" action=""><input type="hidden" name="name" value="login"><input type="hidden" name="dopost" value="login"><input type="hidden" name="gourl" value=""><p><input class="ipt" type="text" name="userid" id="phone" placeholder="电话号码"></p><p><input class="ipt" type="password" name="pwd" id="password" placeholder="密码"></p><div class="toreg clearfix"><input class="btn-sub"type="button"value="登录" id="popup-submit"><p>没有账号？<a href="' + reg_url + '" title="马上注册" target="_blank">马上注册</a></p></div></form></div><div class="c-oth"><p>用第三方账号直接登录</p><div><a href="' + qq_login + '" class="btn-qq" title="QQ账号登录"data-point-2="qq"><span class="dy-icon dy-sina"></span><span>QQ账号登录</span></a></div><div><a href="' + wx_login + '" class="btn-wx" title="微信登录"data-point-2="qq"><span class="dy-icon dy-wx"></span><span>微信登录</span></a></div><div><a href="' + wb_login + '" class="btn-sina" title="微博登录"data-point-2="sina"><span class="dy-icon dy-qq"></span><span>微博登录</span></a></div><p class="forget-pass"><a href="' + forget_url + '" target="_blank">忘记密码？</a></p></div></div></div>'
                    })
                    $(".t-login").on("click", function () {
                        $(".t-login").addClass("current");
                        $(".t-reg").removeClass("current");
                        $(".popLogin").removeClass("hide");
                        $(".popReg").addClass("hide");
                    })
                    $(".t-reg").on("click", function () {
                        $(".t-reg").addClass("current");
                        $(".t-login").removeClass("current");
                        $(".popLogin").addClass("hide");
                        $(".popReg").removeClass("hide");
                    })
                    $(".login-pop-close").on("click", function () {
                        layer.closeAll();
                    })
                    @if(empty(session('login_sign')))
                        document.onkeydown = function(e){

                        var ev = document.all ? window.event : e;
                        if(ev.keyCode==13) {
                            if($('#remember').is(':checked')){
                                var remember = 1;
                            }else{
                                var remember = 0;
                            }
                            var phone = $("#phone").val();
                            var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                            if(!myreg.test(phone))
                            {
                                layer.msg('请输入有效的手机号码！');
                                return;
                            }
                            var password = $("#password").val();
                            if(password.length == 0){
                                layer.msg('密码不能为空！');
                                return;
                            }
                            $.ajax({
                                url: "{{url('auth/quickLogin')}}",
                                type: "post",
                                // dataType: "json",
                                data: {
                                    // 用户名和密码等其他数据，自己获取，不做演示
                                    phone: phone,
                                    password: password,
                                    remember: remember,
                                    _token: "{{csrf_token()}}",
                                },
                                // 这里是正确返回处理结果的处理函数
                                // 假设你就返回了1，2，3
                                // 当然，正常情况是返回JSON数据
                                success: function (result) {
                                    if (result == 'success') {
                                        location.reload();
                                    } else {
                                        layer.alert(result,{icon: 2},function () {
                                            location.reload();
                                        });
                                    }
                                }
                            });
                            // 提交验证码信息，比如登陆页面，你需要提交登陆信息，用户名和密码等登陆数据

                        }
                    }



                    $("#popup-submit").click(function () {
                        if($('#remember').is(':checked')){
                            var remember = 1;
                        }else{
                            var remember = 0;
                        }
                        var phone = $("#phone").val();
                        var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                        if(!myreg.test(phone))
                        {
                           layer.msg('请输入有效的手机号码！');
                            return;
                        }
                        var password = $("#password").val();
                        if(password.length == 0){
                            layer.msg('密码不能为空！');
                            return;
                        }
                        $.ajax({
                            url: "{{url('auth/quickLogin')}}",
                            type: "post",
                            // dataType: "json",
                            data: {
                                // 用户名和密码等其他数据，自己获取，不做演示
                                phone: phone,
                                password: password,
                                remember: remember,
                                _token: "{{csrf_token()}}",
                            },
                            // 这里是正确返回处理结果的处理函数
                            // 假设你就返回了1，2，3
                            // 当然，正常情况是返回JSON数据
                            success: function (result) {
                                if (result == 'success') {
                                    location.reload();
                                } else {
                                    layer.alert(result,{icon: 2},function () {
                                        location.reload();
                                    });
                                }
                            }
                        });

                    });


                    @else
                    // 代码详细说明
                    var handlerPopup = function (captchaObj) {
                        // 注册提交按钮事件，比如在登陆页面的登陆按钮
                        $("#popup-submit").click(function () {
                            // 此处省略在登陆界面中，获取登陆数据的一些步骤
                            // 先校验是否点击了验证码

                            var validate = captchaObj.getValidate();
                            var phone = $("#phone").val();
                            var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                            if (!myreg.test(phone)) {
                                layer.msg('请输入有效的手机号码！');
                                return;
                            }
                            var password = $("#password").val();
                            if (password.length == 0) {
                                layer.msg('密码不能为空！');
                                return;
                            }
                            if (!validate) {
                                layer.msg('请先完成验证！');
                                return;
                            }
                            // 提交验证码信息，比如登陆页面，你需要提交登陆信息，用户名和密码等登陆数据
                            $.ajax({
                                url: "{{url('auth/verifyLogin')}}",
                                type: "post",
                                // dataType: "json",
                                data: {
                                    // 用户名和密码等其他数据，自己获取，不做演示
                                    phone: phone,
                                    password: password,
                                    remember: 0,
                                    _token: "{{csrf_token()}}",
                                    geetest_challenge: validate.geetest_challenge,
                                    geetest_validate: validate.geetest_validate,
                                    geetest_seccode: validate.geetest_seccode
                                },
                                // 这里是正确返回处理结果的处理函数
                                // 假设你就返回了1，2，3
                                // 当然，正常情况是返回JSON数据
                                success: function (result) {
                                    if (result == 'success') {
                                        location.reload();
                                    } else {
                                        layer.alert(result,{icon: 2},function () {
                                            location.reload();
                                        });
                                    }
                                }, error: function (data) {
                                    console.log(data)
                                }
                            });
                        });
                        captchaObj.bindOn("#popup-submit");
                        captchaObj.appendTo(".login-pop");
                        geetest = captchaObj;
                    };

                    $.ajax({
                        // 获取id，challenge，success（是否启用failback）
                        url: url + "/" + (new Date()).getTime(), // 加随机数防止缓存
                        type: "get",
                        dataType: "json",
                        success: function (data) {
                            // 使用initGeetest接口
                            // 参数1：配置参数
                            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
                            initGeetest({
                                gt: data.gt,
                                challenge: data.challenge,
                                product: "popup", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                                offline: !data.success // 表示用户后台检测极验服务器是否宕机，与SDK配合，用户一般不需要关注
                            }, handlerPopup);
                        }
                    });
                @endif

                });
            }
        }
        login.init();
    });
    $(function(){
        document.onkeydown = function(e){
            var ev = document.all ? window.event : e;
            if(ev.keyCode==13) {
                var phone = $("#phone").val();
                var pwd = $("#password").val();
                if(phone.length==0){
                    return;
                }
                var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if(!myreg.test(phone))
                {
                    layer.msg('请输入有效的手机号码！')
                    return;
                }
                if(pwd.length<6){
                    layer.msg('密码格式不正确！')
                    return;
                }
                return geetest.show();
            }
        }

    })
</script>